<?php
class Apply_model extends BZ_Model
{
    protected $table = 'apply';

    /**
     * 添加申请
     */
    public function insertApply($postData)
    {
        $data = array(
            'type'        => $postData['category'], //我要分销-2，我要供应-3
            'user_name'   => isset($postData['user_name']) ? $postData['user_name'] : '', //推荐人
            'province_id' => $postData['provinceid'],
            'city_id'     => $postData['cityid'],
            'district_id' => $postData['areaid'],
            'contacts'    => $postData['contacts'], //联系人
            'phone'       => $postData['phone'],
            'details'     => json_encode($postData['details']),
            'status'      => 1,
            'note'        => $postData['describe'],  //备注
            'created_at'  => date('Y-m-d H:i:s'),
            'updated_at'  => '0000-00-00 00:00:00'
        );
        $this->db->insert($this->table, $data);
        return $this->db->insert_id();
    }
}